package com.lovo.cls;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Test01 {
    public static void main(String[] args) {
//        System.out.println(System.currentTimeMillis());
//        long startTime = System.currentTimeMillis();
//        for(int i = 0;i < 100000;i++){
//            System.out.println("1");
//        }
//        long endTime = System.currentTimeMillis();
//        System.out.println("耗时：" + (endTime - startTime));

        // 向下取整
        System.out.println("Math.floor()：" + Math.floor(15.6));
        // 向上取整
        System.out.println("Math.ceil()：" + Math.ceil(15.1));
        // 四舍五入
        System.out.println("Math.round()：" + Math.round(15.1));
        System.out.println("Math.round()：" + Math.round(15.5));

        // int转Integer
        int a = 100;
        Integer a1 = Integer.valueOf(a);
        // Integer转int
        int a2 = a1.intValue();
        System.out.println(a1 + " " + a2);

        String s = "12345";
        // 字符串转整数
        System.out.println(Integer.parseInt(s) + 500);
        String s1 = a2 + "";

        // 自动装箱和拆箱
        int b = 200;
        Integer b1 = b;
        int b2 = b1;
        System.out.println(b1 + " " + b2);
        System.out.println(b1 + b2);

        // 日期类
        System.out.println(LocalDate.now());
        System.out.println(LocalDateTime.now());

        System.out.println(LocalDate.of(2020,1,1));

        LocalDate localDate = LocalDate.now();
        System.out.println(LocalDate.now().getDayOfWeek().getValue());
//        LocalDate localDate1 = localDate.plusMonths(1);
        System.out.println(LocalDate.now().plusMonths(1).getDayOfWeek().getValue());

        System.out.println(LocalDate.parse("2022-05-20").getDayOfWeek());
    }
}
